package com.huabo.contract.mysql.mapper;

import com.huabo.contract.mysql.entity.TblFlowMySql;

import java.math.BigDecimal;

import com.huabo.contract.mysql.entity.TblFormControllogMySql;
import org.apache.ibatis.annotations.*;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author huabo
 * @since 2021-10-23
 */
public interface TblFlowMySqlMapper extends BaseMapper<TblFlowMySql> {

	@Select("SELECT * FROM TBL_FLOW WHERE FLOWID = #{flowId}")
	TblFlowMySql findFlowInfoById(@Param("flowId") String flowId) throws Exception;

	@Select("SELECT * FROM TBL_FLOW WHERE FLOWNUMBER = #{flowNumber} AND COMPANY = #{orgId}")
	TblFlowMySql findFlowInfoByFlowNumber(@Param("flowNumber")String flowNumber,@Param("orgId") BigDecimal orgId);

	@Select("SELECT * FROM TBL_FLOW WHERE FLOWID = #{flowid}")
	@Options(useGeneratedKeys=true, keyProperty="flowid", keyColumn="FLOWID")
	TblFlowMySql findByFlowid(String flowid);

	@Select("SELECT * FROM TBL_FLOW WHERE FLOWID = #{flowid}")
	TblFlowMySql findByFlow(String flowid);

	@Select("SELECT * FROM TBL_FLOW WHERE FLOWID = #{flowid}")
	TblFlowMySql findFlowid(BigDecimal flowid);

	@InsertProvider(type=TblFlowMySqlMapperSqlConfig.class,method="saveTfl")
    void saveTfl(TblFormControllogMySql tfl);

	@UpdateProvider(type=TblFlowMySqlMapperSqlConfig.class,method="updateTfl")
	void updateTfl(TblFormControllogMySql tfl);

	@Select("SELECT * FROM TBL_FLOW WHERE FLOWID = #{flowid}")
	String selectFlowid(BigDecimal flowId);

	@Select("SELECT * FROM TBL_FLOW WHERE FLOWID = #{flowid}")
	TblFlowMySql findById(String flowid);
}
